package com.secsbrain.development.biz.impl;

import com.secsbrain.common.ResponseVo;
import com.secsbrain.deploy.client.iface.ModelService;
import com.secsbrain.development.biz.AppService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class AppServiceImpl implements AppService {

    private static final Logger LOGGER = LoggerFactory.getLogger(AppService.class);

    @Autowired
    ModelService modelService;

    @Override
    public List<String> fetchBranchByAppId(long id,String env) {
        try {
            ResponseVo<List<String>> branchListVo = modelService.queryBranchList(id, env);
            if (!branchListVo.isSuccess()) {
                LOGGER.error("获取分支列表失败：" + branchListVo.getMsg());
            }
            return branchListVo.getData();
        } catch (Exception e) {
            LOGGER.error("[AppService.fetchBranchByAppId] has an exception", e);
            return null;
        }
    }

}
